package com.tbit.uqbike.client.pojo;

import com.tbit.common.constant.RideLogDetailsConstant;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Objects;

/**
 * 骑行记录
 *
 * @author Leon
 * 2017年4月26日 下午6:11:07
 */
@AllArgsConstructor
@NoArgsConstructor
public class RideLog {
    /**
     * 骑行订单编号
     */
    private String orderNO;
    /**
     * 用户id
     */
    private Integer userId;
    /**
     * 平台账户id
     */
    private Integer accountId;
    /**
     * 设备id
     */
    private Integer machineId;
    /**
     * 设备编号
     */
    private String machineNO;
    /**
     * 用户码
     */
    private String userCode;
    /**
     * 开始时间
     */
    private String startTime;
    /**
     * 结束时间
     */
    private String endTime;
    /**
     * 停车时长
     */
    private Integer stopTime;
    /**
     * 骑行里程
     */
    private Double mileage;
    /**
     * 扣费金额
     */
    private Double money;
    /**
     * 备注
     */
    private String remark;
    /**
     * 用户欠费后的支付时间
     */
    private String payTime;

    private Integer startPointId;

    private Integer endPointId;

    /**
     * 错误码
     */
    private Integer errorCode;
    /**
     * 分区id
     * -1: 还车时车辆未定位到所在分区
     */
    private Integer regionId;

    /**
     * 设备类型
     */
    private Integer machineType;

    /**
     * 处理状态：null，该笔骑行订单没有申诉；0:处理中；1:申诉驳回；2:申诉通过
     */
    private Integer state;

    /**
     * 是否过期 0过期、1未过期
     */
    private Integer expired;

    /**
     * 距离
     */
    private Double distance;
    /**
     * 是否在围栏
     */
    private Boolean inGeo;
    /**
     * 支付状态
     */
    private Integer payStatus;
    /**
     * 抵扣后总费用
     */
    private Long deductionEndMoney;

    /**
     * 设置支付状态和抵扣后总费用
     */
    public void parsePayStatus() {
        if (Objects.isNull(payTime)) {
            payStatus = RideLogDetailsConstant.ORDER_ARREARS;
        } else {
            payStatus = RideLogDetailsConstant.ORDER_PAY;
        }
        if (money != null) {
            deductionEndMoney = money.longValue();
        }
    }

    public Long getDeductionEndMoney() {
        return deductionEndMoney;
    }

    public void setDeductionEndMoney(Long deductionEndMoney) {
        this.deductionEndMoney = deductionEndMoney;
    }

    public Integer getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }

    public String getOrderNO() {
        return orderNO;
    }

    public void setOrderNO(String orderNO) {
        this.orderNO = orderNO;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getAccountId() {
        return accountId;
    }

    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    public Integer getMachineId() {
        return machineId;
    }

    public void setMachineId(Integer machineId) {
        this.machineId = machineId;
    }

    public String getMachineNO() {
        return machineNO;
    }

    public void setMachineNO(String machineNO) {
        this.machineNO = machineNO;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public Integer getStopTime() {
        return stopTime;
    }

    public void setStopTime(Integer stopTime) {
        this.stopTime = stopTime;
    }

    public Double getMileage() {
        return mileage;
    }

    public void setMileage(Double mileage) {
        this.mileage = mileage;
    }

    public Double getMoney() {
        return money;
    }

    public void setMoney(Double money) {
        this.money = money;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getPayTime() {
        return payTime;
    }

    public void setPayTime(String payTime) {
        this.payTime = payTime;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public Integer getStartPointId() {
        return startPointId;
    }

    public void setStartPointId(Integer startPointId) {
        this.startPointId = startPointId;
    }

    public Integer getEndPointId() {
        return endPointId;
    }

    public void setEndPointId(Integer endPointId) {
        this.endPointId = endPointId;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public Integer getRegionId() {
        return regionId;
    }

    public void setRegionId(Integer regionId) {
        this.regionId = regionId;
    }

    public Integer getMachineType() {
        return machineType;
    }

    public void setMachineType(Integer machineType) {
        this.machineType = machineType;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Integer getExpired() {
        return expired;
    }

    public void setExpired(Integer expired) {
        this.expired = expired;
    }

    public Double getDistance() {
        return distance;
    }

    public void setDistance(Double distance) {
        this.distance = distance;
    }

    public Boolean getInGeo() {
        return inGeo;
    }

    public void setInGeo(Boolean inGeo) {
        this.inGeo = inGeo;
    }

    @Override
    public String toString() {
        return "RideLog{" +
                "orderNO='" + orderNO + '\'' +
                ", userId=" + userId +
                ", accountId=" + accountId +
                ", machineId=" + machineId +
                ", machineNO='" + machineNO + '\'' +
                ", userCode='" + userCode + '\'' +
                ", startTime='" + startTime + '\'' +
                ", endTime='" + endTime + '\'' +
                ", stopTime=" + stopTime +
                ", mileage=" + mileage +
                ", money=" + money +
                ", remark='" + remark + '\'' +
                ", payTime='" + payTime + '\'' +
                ", startPointId=" + startPointId +
                ", endPointId=" + endPointId +
                '}';
    }
}
